<script>
import axios from 'axios'
export default {
    methods: {
        send() {
            let xhr = new XMLHttpRequest()
            xhr.open("GET", "/get", true);
            xhr.send()

            xhr.onreadystatechange = () => {
                if (xhr.readyState === 4 && xhr.status === 200) {
                    // JSON -- String  JSON.stringify()
                    // String -- JSON JSON.parse()
                    console.log(xhr.responseText)
                }
            }
        },
        test() {
            // fetch("/post", {
            //     method: 'POST',
            //
            // })
            // fetch("/get").then(res => res.json()).then(res => {
            //     console.log(res)
            // })
            axios.get('http://localhost:8080/list').then(res => {
                console.log(res)
            })
        }
    }
}
</script>

<template>
<el-button type="success" @click="test">发送</el-button>
</template>

<style scoped>

</style>